package com.pllandxzx.service.impl;

import com.pllandxzx.bean.MenuBean;
import com.pllandxzx.dto.ResponseDTO;
import com.pllandxzx.mapper.MenuMapper;
import com.pllandxzx.service.MenuService;
import com.pllandxzx.tool.BuildMenuTree;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName：MenuServiceImpl
 * @Author: 阿⭐
 * @Date: 2025/6/12 9:29
 * @Description: TODO
 */
@Service
public class MenuServiceImpl implements MenuService {
    @Autowired
    private MenuMapper menuMapper;

    @Autowired
    private BuildMenuTree buildMenuTree;

    @Override
    public ResponseDTO getAllMenu() {
        List<MenuBean> allMenus = menuMapper.getAllMenu();
        return ResponseDTO.Success(buildMenuTree.buildMenuTree(allMenus));
    }

    @Override
    public ResponseDTO getRoleMenus(long roleId) {
        return ResponseDTO.Success(menuMapper.getRoleMenus(roleId));
    }



}
